using System.Collections.Generic;
using UnityEngine;

namespace CinemaDirector
{
	public class GGVariableStore
	{
		protected Dictionary<string, GGVariable> variables = new Dictionary<string, GGVariable>();

		public bool ContainsVariable(string name)
		{
			return variables.ContainsKey(name);
		}

		public T GetVariable<T>(string name) where T : GGVariable, new()
		{
			if (!variables.ContainsKey(name))
			{
				variables.Add(name, new T());
			}
			GGVariable gGVariable = variables[name];
			T val = gGVariable as T;
			if (val == null)
			{
				Debug.LogError("Variable of different type with same name " + name);
			}
			return val;
		}
	}
}
